﻿using System;
using Interpreter;
using Model;
using ME = Model.Environment;

namespace Test
{
	class TestInterpreter
	{
		static void Main(string[] args)
		{
			Interpreter.StringInterpreter interpreter = new Interpreter.StringInterpreter();
			Persistence persistence = new Persistence();
			//string zellePaul = "Mensch(name:string, alter:Double, geschlecht:string, wohnort:string)";
			string tod = "Tod()";
			string lebendig = "Lebendig()";

			string einsamkeit = "Lebendig(Lebendig<3 or Umgebung: Tod>5)";


			try
			{
				persistence.ParseCellDefinition(tod);
				persistence.ParseCellDefinition(lebendig);
				Cell todCell = new Cell();
				todCell.SetCellDefinitionTarget(new CauseExpression(ME.CellDefinitions["Tod"], 1, new System.Collections.Generic.Dictionary<string, AttributExpression>()));

				Expression expr = interpreter.evaluateRuleExpression(einsamkeit);
				expr.evaluate(todCell);

			}
			catch (Exception e)
			{
				Console.WriteLine(e.ToString());
			}
		}
	}
}
